#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 3e4 + 5;
const int M = 3e5 + 5;

int n, m;
string s[N];
int tr[M][26], ed[M], tot;
void insert(string s) {
  int p = 0;
  for (char c : s) {
    int ch = c - 'a';
    if (!tr[p][ch]) tr[p][ch] = ++tot;
    p = tr[p][ch];
  }
  ed[p] = 1;
}
int g[26][26], deg[26];
bool check(string s) {
  memset(g, 0, sizeof(g));
  memset(deg, 0, sizeof(deg));
  int p = 0;
  bool find_end = false;
  for (char c : s) {
    if (find_end) return false;
    int ch = c - 'a';
    rep(i, 0, 25) {
      if (i == ch || !tr[p][i]) continue;
      g[ch][i] = 1;
    }
    p = tr[p][ch];
    if (ed[p]) find_end = true;
  }
  // topo sort
  rep(i, 0, 25) rep(j, 0, 25) if (g[j][i]) deg[i]++;
  queue<int> q;
  rep(i, 0, 25) if (!deg[i]) q.push(i);
  int cnt = 0;
  while (q.size()) {
    int u = q.front();
    q.pop();
    cnt++;
    rep(v, 0, 25) if (g[u][v]) if (--deg[v] == 0) q.push(v);
  }
  return cnt == 26;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) cin >> s[i];
  rep(i, 1, n) insert(s[i]);
  vector<int> ans;
  rep(i, 1, n) if (check(s[i])) ans.push_back(i);
  cout << ans.size() << endl;
  for (int x : ans) cout << s[x] << endl;
  return 0;
}